<!DOCTYPE html>
<html lang="{{.Lang}}">
<head>
	<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
	<meta name="viewport" content="width=device-width,user-scalable=no"/>
	<meta name="format-detection" content="telephone=no"/>
	<meta name="renderer" content="webkit"/>
	<meta name="wap-font-scale" content="no"/>
	<title>{{.Path}}</title>
	<link rel="shortcut icon" type="image/x-icon" href="{{.RootRelPath}}?asset=favicon.ico"/>
	<link rel="stylesheet" type="text/css" href="{{.RootRelPath}}?asset=index.css"/>
</head>
<body class="{{if .IsRoot}}root-dir{{else}}sub-dir{{end}}">
{{$contextQueryString := .Context.QueryString -}}
{{$isSimple := .IsSimple -}}
{{$SubItemPrefix := .SubItemPrefix -}}
{{if not $isSimple -}}
<ol class="path-list" translate="no">
	{{range .Paths -}}
	<li><a href="{{.Path}}{{$contextQueryString}}">{{fmtFilename .Name}}</a></li>
	{{end -}}
</ol>
{{if .LoginAvail -}}
<a class="login" href="{{if ne .Status 401}}{{.RootRelPath}}?auth={{.Path}}{{$contextQueryString}}{{end}}">{{.Trans.LoginLabel}}</a>
{{else if .AuthUserName -}}
<span class="login">[{{.AuthUserName}}]</span>
{{end -}}
{{if .CanUpload -}}
<div class="upload-status">
	<span class="label info">
		<span class="content">{{.Trans.UploadingLabel}}</span>
	</span>
	<span class="label warn">
		<span class="content">{{.Trans.UploadFailLabel}}<span class="message"></span></span>
	</span>
	<span class="progress"></span>
</div>
{{end -}}

{{if .CanMkdir -}}
<div class="panel mkdir">
	<form method="POST" action="{{.SubItemPrefix}}?mkdir">
		<input type="text" autocomplete="off" name="name" class="name"/>
		<input type="hidden" name="contextquerystring" value="{{$contextQueryString}}"/>
		<input type="submit" value="{{.Trans.MkdirLabel}}" class="submit"/>
	</form>
</div>
{{end -}}

{{if .CanUpload -}}
<script type="text/javascript">
	function showUploadDirFailMessage() {
		alert('{{.Trans.UploadDirFailMessage}}');
	}
</script>
<div class="tab upload-type">
	<h3>{{.Trans.UploadLabel}}</h3>
	<a class="file active" tabindex="0" role="button" title="{{.Trans.UploadFilesHint}}">{{.Trans.UploadFilesLabel}}</a>
	{{if .CanMkdir}}<a class="dirfile" tabindex="0" role="button" title="{{.Trans.UploadDirHint}}">{{.Trans.UploadDirLabel}}</a>
	<a class="innerdirfile" tabindex="0" role="button" title="{{.Trans.UploadDirContentsHint}}">{{.Trans.UploadDirContentsLabel}}</a>{{end}}
</div>
<div class="panel upload">
	<form method="POST" action="{{.SubItemPrefix}}?upload" enctype="multipart/form-data">
		<input type="file" name="file" multiple="multiple"/>
		<input type="hidden" name="contextquerystring" value="{{$contextQueryString}}"/>
		<button type="submit" class="submit">{{.Trans.UploadLabel}}</button>
	</form>
</div>
{{end -}}

{{if .CanArchive -}}
<div class="archive">
	<a href="{{.SubItemPrefix}}?tar">.tar</a>
	<a href="{{.SubItemPrefix}}?tgz">.tar.gz</a>
	<a href="{{.SubItemPrefix}}?zip">.zip</a>
</div>
{{end -}}

{{if .CanDelete -}}
<script type="text/javascript">
	function confirmDelete(e) {
		var form = e.target;
		var name = form.name.value;
		var proceed = confirm('{{.Trans.DeleteConfirm}}\n' + name);
		if (!proceed) {
			e.preventDefault();
		}
		return proceed;
	}
</script>
{{end -}}
{{end -}}
{{if .SubItemsHtml -}}
<div class="panel filter">
	<div class="form">
		<input type="text" accesskey="r" placeholder="{{.Trans.FilterLabel}}"/>
		<button type="reset">X</button>
	</div>
</div>
{{end -}}
<ul class="item-list{{if .HasDeletable}} has-deletable{{end}}">
	{{if not $isSimple -}}
	<li class="header">{{$dirSort := .SortState.DirSort}}{{$sortKey := .SortState.Key}}
		<span class="detail">
		<a class="field dir" href="{{.SubItemPrefix}}{{.Context.QueryStringOfSort .SortState.NextDirSort}}">{{.Trans.ListDirLabel}}{{if eq $dirSort -1}}&uarr;{{else if eq $dirSort 1}}&darr;{{end}}</a>
		<a class="field name" href="{{.SubItemPrefix}}{{.Context.QueryStringOfSort .SortState.NextNameSort}}">{{.Trans.ListNameLabel}}{{if eq $sortKey "n"}}&uarr;{{else if eq $sortKey "N"}}&darr;{{end}}</a>
		<a class="field type" href="{{.SubItemPrefix}}{{.Context.QueryStringOfSort .SortState.NextTypeSort}}">{{.Trans.ListTypeLabel}}{{if eq $sortKey "e"}}&uarr;{{else if eq $sortKey "E"}}&darr;{{end}}</a>
		<a class="field size" href="{{.SubItemPrefix}}{{.Context.QueryStringOfSort .SortState.NextSizeSort}}">{{.Trans.ListSizeLabel}}{{if eq $sortKey "s"}}&uarr;{{else if eq $sortKey "S"}}&darr;{{end}}</a>
		<a class="field time" href="{{.SubItemPrefix}}{{.Context.QueryStringOfSort .SortState.NextTimeSort}}">{{.Trans.ListTimeLabel}}{{if eq $sortKey "t"}}&uarr;{{else if eq $sortKey "T"}}&darr;{{end}}</a>
		</span>
	</li>
	<li class="parent">
		<a href="{{if .IsRoot}}./{{else}}../{{end}}{{$contextQueryString}}" class="detail">
		<span class="field name" translate="no">../</span>
		<span class="field size"></span>
		<span class="field time"></span>
		</a>
	</li>
	{{end -}}
	{{range .SubItemsHtml -}}
	<li class="{{.Type}}">
		<a href="{{.Url}}" class="detail">
		<span class="field name" translate="no">{{.DisplayName}}</span>
		<span class="field size">{{.DisplaySize}}</span>
		<span class="field time">{{.DisplayTime}}</span>
		</a>
		{{if and (not $isSimple) .DeleteUrl}}<form class="delete" method="post" action="{{$SubItemPrefix}}?delete" onsubmit="return confirmDelete(event)"><input type="hidden" name="name" value="{{.DeleteUrl}}"/><input type="hidden" name="contextquerystring" value="{{$contextQueryString}}"/><button type="submit">x</button></form>{{end}}
	</li>
	{{end -}}
</ul>

{{if ne .Status 200}}<div class="error">{{.Status}}
{{if eq .Status 401 -}}
  {{.Trans.Error401 -}}
{{else if eq .Status 403 -}}
  {{.Trans.Error403 -}}
{{else if eq .Status 404 -}}
  {{.Trans.Error404 -}}
{{else -}}
  {{.Trans.ErrorStatus -}}
{{end}}</div>{{end}}

<script type="text/javascript" src="{{.RootRelPath}}?asset=index.js" defer="defer" async="async"></script>
</body>
</html>
